<template>
  <div class="song-list">
    <ul>
      <li class="item" v-for="(song, index) in songs" :key="index" @click="selectSong(song, index)">
        <!-- <div class="rank"></div> -->
        <div class="content">
            <h2 class="name">{{song.name}}</h2>
            <p class="desc">{{song | handleDesc}}</p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    songs: Array,
    default: []
  },
  data() {
    return {
    }
  },
  filters: {
    handleDesc(value) {
      return `${value.singer}.${value.album}`
    }
  },
  watch: {},
  computed: {},
  methods: {
    selectSong(song, index) {
      this.$emit('selectSong', song, index)
    }
  },
  created() {},
  mounted() {}
}
</script>
<style lang="stylus" scoped>
@import "~@/common/stylus/variable"
@import "~@/common/stylus/mixin"

.song-list
  .item
    display: flex
    align-items: center
    box-sizing: border-box
    height: 64px
    font-size: $font-size-medium
    .rank
      flex: 0 0 25px
      width: 25px
      margin-right: 30px
      text-align: center
      .icon
        display: inline-block
        width: 25px
        height: 24px
        background-size: 25px 24px
        &.icon0
          bg-image('first')
        &.icon1
          bg-image('second')
        &.icon2
          bg-image('third')
      .text
        color: $color-theme
        font-size: $font-size-large
    .content
      flex: 1
      line-height: 20px
      overflow: hidden
      .name
        no-wrap()
        color: $color-text
      .desc
        no-wrap()
        margin-top: 4px
        color: $color-text-d
</style>